const install = (Vue, vm) => {
	// 此处没有使用传入的params参数
	let getIndex = params => {
		return vm.$u.get('/api/index', params)
	}

	let goLogin = params => {
		return vm.$u.post('/api/auth/login', params)
	}
	let goRegister = params => {
		return vm.$u.post('/api/auth/register', params)
	}
	let userInfo = () => {
		return vm.$u.get('/api/user')
	}

	vm.$u.api = {
		getIndex,
		goLogin,
		userInfo,
		goRegister
	};


	//封装patch请求
	vm.$u.patch = (url, params) => {
		//模拟patch请求
		const _params = {
			...params,
			_method: 'PATCH'
		}
		return vm.$u.post(url, _params)
	}
}




export default {
	install
}
